#pragma once
#include "Singleton.h"
#include <hash_map>

class Material;

class MaterialManager : public Singleton<MaterialManager>
{
	typedef stdext::hash_map<std::string, Material*> MaterialMap;
public:
	MaterialManager();
	~MaterialManager();

	Material* Create(const std::string& name);
	Material* GetByName(const std::string& name);
	bool RemoveByName(const std::string& name);
	void RemoveAll();
	void LoadFromCache();
	void BuildReserveMaterial();

	const Material* getDefaultMaterial() const { return mDefaultMatrial; }
	const Material* getShapeMaterial() const { return mShapeMaterial; }

private:
	MaterialMap mMaterials;
	Material* mDefaultMatrial;
	Material* mShapeMaterial;
};
